#include <bits/stdc++.h>
using namespace std;
int a[201][201];
int main() {
    int n, m, c = 0, g, s, b, q;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
            g = a[i][j] % 10;
            s = a[i][j] / 10 % 10;
            b = a[i][j] / 100 % 10;
            q = a[i][j] / 1000;
            if ((g + s + b + q) % 2 == 1) {
                c++;
            }
        }
    }
    cout << c << endl;
}